package com.csun.cmny.provider.service.impl;

import com.csun.cmny.core.support.BaseService;
import com.csun.cmny.provider.dao.OmcSignInMapper;
import com.csun.cmny.provider.dto.OmcSignInQueryDto;
import com.csun.cmny.provider.model.domain.OmcSignIn;
import com.csun.cmny.provider.service.OmcSignInService;
import com.csun.cmny.provider.vo.OmcSignInVo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Lijun
 * @description:
 * @date 2019/11/27 13:55
 */
@Slf4j
@Service
@Transactional
public class OmcSignInServiceImpl extends BaseService<OmcSignIn> implements OmcSignInService {
    @Resource
    private OmcSignInMapper omcSignInMapper;

    /**
     * 查询打卡记录
     * @param signInDto
     * @return
     */
    @Override
    public PageInfo querySignInWithPage (OmcSignInQueryDto signInDto){
        PageHelper.startPage(signInDto.getPageNum(),signInDto.getPageSize());
        List<OmcSignInVo> list = omcSignInMapper.querySignInWithPage(signInDto);
        return new PageInfo<>(list);
    }

    /**
     * 查询该设备七天内的打卡记录
     * @param deviceId
     * @return
     */
    @Override
    public List<OmcSignInVo> querySignIn(Long deviceId){
        return omcSignInMapper.querySignIn(deviceId);
    }
}
